package com.xu.fountain.Entity;

import javax.persistence.*;
import java.sql.Timestamp;

/**
 * @Message: created by XUBO on 2018/4/1
 * @Description:
 */

@Entity
@Table(name = "user", schema = "me", catalog = "")
public class UserEntity {
    private Integer id;
    private String username;
    private String password;
    private String token;
    private String img;
    private String mobileNo;
    private String email;
    private Integer userType;
    private Timestamp registerTime;

    @Id
    @Column(name = "id")
    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    @Basic
    @Column(name = "username")
    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    @Basic
    @Column(name = "password")
    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    @Basic
    @Column(name = "token")
    public String getToken() {
        return token;
    }

    public void setToken(String token) {
        this.token = token;
    }

    @Basic
    @Column(name = "img")
    public String getImg() {
        return img;
    }

    public void setImg(String img) {
        this.img = img;
    }

    @Basic
    @Column(name = "mobile_no")
    public String getMobileNo() {
        return mobileNo;
    }

    public void setMobileNo(String mobileNo) {
        this.mobileNo = mobileNo;
    }

    @Basic
    @Column(name = "email")
    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email;
    }

    @Basic
    @Column(name = "user_type")
    public Integer getUserType() {
        return userType;
    }

    public void setUserType(Integer userType) {
        this.userType = userType;
    }

    @Basic
    @Column(name = "register_time")
    public Timestamp getRegisterTime() {
        return registerTime;
    }

    public void setRegisterTime(Timestamp registerTime) {
        this.registerTime = registerTime;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        UserEntity that = (UserEntity) o;

        if (id != that.id) return false;
        if (username != null ? !username.equals( that.username ) : that.username != null) return false;
        if (password != null ? !password.equals( that.password ) : that.password != null) return false;
        if (token != null ? !token.equals( that.token ) : that.token != null) return false;
        if (img != null ? !img.equals( that.img ) : that.img != null) return false;
        if (mobileNo != null ? !mobileNo.equals( that.mobileNo ) : that.mobileNo != null) return false;
        if (email != null ? !email.equals( that.email ) : that.email != null) return false;
        if (userType != null ? !userType.equals( that.userType ) : that.userType != null) return false;
        if (registerTime != null ? !registerTime.equals( that.registerTime ) : that.registerTime != null) return false;

        return true;
    }

    @Override
    public int hashCode() {
        int result = id;
        result = 31 * result + (username != null ? username.hashCode() : 0);
        result = 31 * result + (password != null ? password.hashCode() : 0);
        result = 31 * result + (token != null ? token.hashCode() : 0);
        result = 31 * result + (img != null ? img.hashCode() : 0);
        result = 31 * result + (mobileNo != null ? mobileNo.hashCode() : 0);
        result = 31 * result + (email != null ? email.hashCode() : 0);
        result = 31 * result + (userType != null ? userType.hashCode() : 0);
        result = 31 * result + (registerTime != null ? registerTime.hashCode() : 0);
        return result;
    }
}
